﻿using Microsoft.AspNetCore.Mvc;

namespace OnWork.Admin.Controllers
{
    /// <summary>
    /// 演示控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    [ApiExplorerSettingsOnWork("SwaggerDemo")]
    public class SwaggerDemoController : ControllerBase
    {
        private readonly ILogger<SwaggerDemoController> _logger;

        /// <summary>
        /// 测试
        /// </summary>
        /// <param name="logger"></param>
        public SwaggerDemoController(ILogger<SwaggerDemoController> logger)
        {
            _logger = logger; ;
        }

        /// <summary>
        /// Action1
        /// </summary>
        /// <returns></returns>
        [HttpGet("Action1")]
        [ApiExplorerSettingsOnWork(TagOrder = -1)]
        public string Action1()
        {
            _logger.LogDebug("测试Action1日志记录");
            return "Group1";
        }

        /// <summary>
        /// Action3
        /// </summary>
        /// <returns></returns>
        [HttpGet("Action3")]
        [ApiExplorerSettingsOnWork(TagOrder = 2)]
        public string Action3()
        {
            _logger.LogError("测试Action2日志记录");
            return "Group1";
        }

        /// <summary>
        /// Action2
        /// </summary>
        /// <returns></returns>
        [HttpGet("Action2")]
        [ApiExplorerSettingsOnWork(TagOrder = -2)]
        public string Action2()
        {
            _logger.LogWarning("测试Action3日志记录");
            return "Group1";
        }
    }
}